<?php
namespace app\admin\logic;
use app\admin\validate\Adv as AdvValidate;

class AdvLogic extends BaseLogic {

    /**
     * 检查修改广告规则
     * @param $params
     * @return mixed
     */
    public function check_save_adv_rule($params){
        $validate = new AdvValidate();
        $r = $validate->scene('edit')->check($params);
        if(!$r){
            return $this->get_response(0,$validate->getError());
        }

        $maps = [];
        $maps[] = ['id','=',$params['advid']];
        $a_detail = model('adv')->get_detail($maps,'id');
        if(empty($a_detail)){
            return $this->get_response(0,'该广告不存在');
        }

        $data['a_detail'] = $a_detail;
        return $this->get_response(1,'OK',$data);
    }
}